package example.simple_mindmap.consistency;

import example.simple_mindmap.consistency.dataFunc.DataFunc;
import example.simple_mindmap.consistency.strategy.scheme.IConsistencyScheme;

/**
 * @Program: 8.mindmap
 * @Author: 海里的鱼
 * @Create: 2024-08-28 22:07
 * @Name: 一致性数据
 * @Desc: TODO
 */
public class ConsistencyData {
    //数据
    private Object data;
    //数据类型
    private DataType type;
    //数据操作方法（策略模式）
    private DataFunc dataFunc;
    //一致性方案（策略模式）
    private IConsistencyScheme scheme;

    /** ---------------------------------------------------------------------------------------------------------------------
     * @Method  : 构造方法
     * @Describe: TODO
     **/
     public ConsistencyData(Object data, DataType type, DataFunc dataFunc, IConsistencyScheme scheme) {
        this.data = data;
        this.type = type;
        this.dataFunc = dataFunc;
        this.scheme = scheme;
    }


    /** ---------------------------------------------------------------------------------------------------------------------
     * @Method  : 从type中获取交换机名和队列名
     * @Describe: TODO
     **/
    public String getRoutingKey() {
        return null == type ?null :type.getRoutKey();
    }
    public String getExchangeName() {
        return null == type ?null :type.getExchangeName();
    }

    public DataFunc getWriteFunc() {
        return dataFunc;
    }

    public void setWriteFunc(DataFunc dataFunc) {
        this.dataFunc = dataFunc;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public DataType getType() {
        return type;
    }

    public void setType(DataType type) {
        this.type = type;
    }



    public IConsistencyScheme getScheme() {
        return scheme;
    }

    public void setScheme(IConsistencyScheme scheme) {
        this.scheme = scheme;
    }





}
